import React from "react";
import {useDispatch} from "react-redux";

import {startSpinner, stopSpinner} from "../../store/actions/auth.actions";

export default WrapperComponent => props => {
    const dispatch = useDispatch();
    const additionalProps = {
        startSpinner: () => dispatch(startSpinner()),
        stopSpinner: () => dispatch(stopSpinner())
    };

    return <WrapperComponent {...props} {...additionalProps}/>
};